package com.etone.smartAudit.onlyoffice.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Data
public class OnlyOfficeConfig {

    @Value("${only_office.url:http://192.168.9.37:8088}")
    private String host;// url: http://192.168.9.37:8088

    @Value("${only_office.sslconfig:http://}")
    private String sslconfig;//: http://

    @Value("${only_office.converter:/ConvertService.ashx}")
    private String converter;//: /ConvertService.ashx

    @Value("${only_office.tempstorage:/ResourceService.ashx}")
    private String tempstorage;// tempstorage:

    @Value("${only_office.api_js:/web-apps/apps/api/documents/api.js}")
    private String apiJs;///api_js:

    @Value("${only_office.preloader:/web-apps/apps/api/documents/cache-scripts.html}")
    private String preloader;//preloader:

    /***
     * 初始化数据
     * @return
     */
    public OnlyOfficeConfig init() {
        OnlyOfficeConfig office = new OnlyOfficeConfig();
        office.setApiJs(host + this.apiJs);
        office.setConverter(host + this.converter);
        office.setPreloader(host + this.preloader);
        office.setTempstorage(host + this.tempstorage);
        return office;
    }
}
